package com.bzhang.springcloud.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author ：Bin.Z
 * @description：
 * @date ：2022/7/5 9:38
 */
@Configuration
public class GateWayConfig {

    @Bean
    public RouteLocator customRouteLocator(RouteLocatorBuilder routeLocatorBuilder) {
        RouteLocatorBuilder.Builder routes = routeLocatorBuilder.routes();
        routes.route("path_rote_atguigu", r -> r.path("/19930521zhang").uri(
                "https://www.cnblogs.com/")).build();
//        routes.route("payment_routh", r -> r.path("/payment/get/**").uri(
//                "http://localhost:8002")).build();
        return routes.build();
    }
}
